hvm ioemu: Do not initialise the LSI SCSI interface if no SCSI discs
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 25 Apr 2007 17:12:03 +0000 (18:12 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 25 Apr 2007 17:12:03 +0000 (18:12 +0100)
are attached to the guest.
Signed-off-by: Keir Fraser <keir@xensource.com>
tools/ioemu/hw/pc.c

index a2063c06e44f2c32a1a4f1d30e4861d94d79680f..0a9cd0db35d3a85485e9bfbbf3f09e343fde6b92 100644 (file)
@@ -923,11 +923,12 @@ static void pc_init1(uint64_t ram_size, int vga_ram_size, char *boot_device,
 #else
     if (pci_enabled) {
         void *scsi;
-
-        scsi = lsi_scsi_init(pci_bus, -1);
         for (i = 0; i < MAX_SCSI_DISKS ; i++) {
-            if (bs_table[i + MAX_DISKS]) 
-                lsi_scsi_attach(scsi, bs_table[i + MAX_DISKS], -1);
+            if (!bs_table[i + MAX_DISKS])
+                continue;
+            if (!scsi)
+                scsi = lsi_scsi_init(pci_bus, -1);
+            lsi_scsi_attach(scsi, bs_table[i + MAX_DISKS], -1);
         }
     }
 #endif /* !CONFIG_DM */